<html>
<head>
    <title>requestAnimationFrame</title>
</head>
<body>
    <div id="foo">
        foo
    </div>

    <script>
        (function() {
            let start = null;
            let element = document.getElementById('foo');
            element.style.position = 'absolute';

            function step(timestamp) {
                if (!start) {
                    start = timestamp;
                }
                let progress = timestamp - start;
                element.style.left = Math.min(progress / 10, 200) + 'px';
                if (progress < 2000) {
                    window.requestAnimationFrame(step);
                }
            }

            window.requestAnimationFrame(step);
        })()
    </script>
</body>
</html>
